<!DOCTYPE html>
<html lang="en"  xmlns:th="http://www.thymeleaf.org/">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
  <div th:replace="header::common"></div>
</head>
<body>
  <a class="btn btn-primary" href="/user/toAdd">添加</a>
  <button class="btn btn-success">添加</button>
  <button class="btn btn-danger">（危险）Danger</button>
  <table class="table table-striped table-bordered table-hover table-condensed">
    <tr class="success">
      <td>id</td>
      <td>名字</td>
      <td>密码</td>
      <td>邮箱</td>
      <td>电话</td>
      <td>删除</td>
    </tr>
    <tr th:each="user:${list}">
      <td th:text="${user.id}">1</td>
      <td th:text="${user.name}">zhangsan</td>
      <td th:text="${user.password}">123</td>
      <td th:text="${user.email}">43434@qq.com</td>
      <td th:text="${user.phone}">121321312</td>
      <td><a th:onclick="|deleteById(${user.id})|" >删除</a></td>
    </tr>

  </table>

<!-- javascript -->
<script>
  function deleteById(id) {
    /*let isDelete = confirm('您确认要删除么？');
    if (isDelete) {
        location.href = '/user/deleteById?id=' + id;
    }*/

    layer.confirm(
            '您确认要退出么',
            {icon:3},
            function() {
              location.href = '/user/deleteById?id=' + id;
            }
    );
  }
</script>
</body>
</html>